<script setup lang="ts">
import { useRouter } from "vue-router";
import useConsultStore from "@/pinia/modules/consultStore.ts";
import { ConsultType } from "@/enum";

import type { Router } from "vue-router";

const router: Router = useRouter();

const consultStore = useConsultStore();


/* 第一步，记录问诊类型的函数---问医生1、极速问诊2、开药门诊3 点击问医生、极速问诊、开药门诊的回调函数，需要记录问诊的类型并且跳转到对应的页面*/
const handleClick = (path: string, type: number) => {
    /*
    * path:需要跳转的页面
    * type:问诊的类型
    * */
    // 跳转页面
    router.push(path);
    // 记录问诊类型
    consultStore.setType(type);
};

</script>

<template>
    <van-row>
        <van-col span="8">
            <a class="nav" @click="handleClick('/doctor',ConsultType.Doctor)">
                <svg-icon svg-name="doctor" width="45px" height="45px"></svg-icon>
                <p class="title">问医生</p>
                <p class="desc">按科室查问医生</p>
            </a>
        </van-col>
        <van-col span="8">
            <a class="nav" @click="handleClick('consult',ConsultType.Fast)">
                <svg-icon svg-name="graphic" width="45px" height="45px"></svg-icon>
                <p class="title">极速问诊</p>
                <p class="desc">20s医生极速回复</p>
            </a>
        </van-col>
        <van-col span="8">
            <a class="nav" @click="handleClick('/medicine',ConsultType.Medication)">
                <svg-icon svg-name="prescribe" width="45px" height="45px"></svg-icon>
                <p class="title">开药门诊</p>
                <p class="desc">线上买药更方便</p>
            </a>
        </van-col>
    </van-row>
</template>

<style scoped lang="scss">
@import "../styles/styles";

</style>
